using System;
using TMPro;
using UnityEngine;
using Voodoo.GameOps;
using Voodoo.Sauce.Core;

public class GemShopView : MonoBehaviour, IPurchaseDelegateWithInfo, IPurchaseDelegateBase
{
	public CanvasGroup _canvas;

	public GameObject _openButton;

	public TextMeshProUGUI _50Gems;

	public TextMeshProUGUI _250Gems;

	public TextMeshProUGUI _750Gems;

	public TextMeshProUGUI _GemsNoAds;

	public GameObject _noAdsButton;

	public void Hide()
	{
		_canvas.interactable = false;
		_canvas.blocksRaycasts = false;
		_canvas.alpha = 0f;
	}

	public void OnInitializeFailure(VoodooInitializationFailureReason reason)
	{
	}

	public void OnInitializeSuccess()
	{
	}

	public void OnPurchaseComplete(ProductReceivedInfo productReceivedInfo, PurchaseValidation purchaseValidation)
	{
		switch (productReceivedInfo.ProductId)
		{
		case "io.voodoo.bucketcrusher.gems50":
			InventoryManager.Instance.AddGems(50);
			break;
		case "io.voodoo.bucketcrusher.gems250":
			InventoryManager.Instance.AddGems(250);
			break;
		case "io.voodoo.bucketcrusher.gems750":
			InventoryManager.Instance.AddGems(750);
			break;
		case "io.voodoo.bucketcrusher.gemsnoads":
			InventoryManager.Instance.AddGems(250);
			break;
		}
		Hide();
	}

	public void OnPurchaseFailure(VoodooPurchaseFailureReason reason, ProductReceivedInfo productReceivedInfo, string description)
	{
		throw new NotImplementedException();
	}

	public void ShowPanel()
	{
		Show();
	}

	public void BuyWithRV()
	{
		InventoryManager.Instance.AddGems(20);
	}

	public void BuyItem(string productID)
	{
	}

	private void Awake()
	{
		Hide();
		_openButton.SetActive(Preloader.GemIAP.IsEnabled);
	}

	public void Show()
	{
		_canvas.interactable = true;
		_canvas.blocksRaycasts = true;
		_canvas.alpha = 1f;
	}
}
